#!/bin/sh

Build()
{
    echo "Build"
    PWD1=$PWD;
    mkdir build;
    cd build;
    cmake -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_CXX_COMPILER=g++ -DBUILD_MODULES=1 -DCMAKE_INSTALL_PREFIX:PATH=$PWD1 $PWD1;
    make install;
    make test;
    cd $PWD1;
}

Clean()
{
    echo "Clean"
    rm -rf bin build lib share;
    rm *.xml;
    rm *.out.csv;
}

Rebuild()
{
    Clean
    Build
}

if test $# -eq 0
then
    Build $@
else
    case $1 in
	"clean") Clean $@;;
	"rebuild") Rebuild $@;;
	*) echo "Unkown option '$1'.";;
    esac
fi
